/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package objective;

/**
 *
 * @author daz
 */
public class XequalY implements IObjective {

    private int violateDegrees;
    private int x;
    private int y;

    public XequalY(int x, int y) {
        this.x = x;
        this.y = y;
        this.violateDegrees = calculateViolation(x, y);

    }

    private int calculateViolation(int x, int y) {
        return Math.abs(x - y);
    }

    @Override
    public int getAssignDelta(int index, int newValue) {
        return calculateViolation(x, newValue) - violateDegrees;
    }

    @Override
    public int getViolateDegrees() {
        return this.violateDegrees;
    }
}
